"""
自定义viewet
"""

from gesture_demo_server.common import mixins
from gesture_demo_server.common.filter import MSearchFilter, MOrderingFilter
from gesture_demo_server.common.pagination import CustomLimitOffsetPagination


class ModelViewSet(mixins.MCreateModelMixin,
                   mixins.MRetrieveModelMixin,
                   mixins.MUpdateModelMixin,
                   mixins.MDestroyModelMixin,
                   mixins.MListModelMixin):
    """
    提供默认 `create()`, `retrieve()`, `update()`,
    `partial_update()`, `destroy()` and `list()` actions 实现的类.
    """
    pass


class BaseViewSet(ModelViewSet):
    # 分页相关类
    pagination_class = CustomLimitOffsetPagination
    # 通用过滤后端，可用于过滤列表视图返回的结果。
    filter_backends = (MSearchFilter, MOrderingFilter)
